//乘积最大子数组
class Solution {
public:
    int maxProduct(vector<int>& nums) {
        int n = nums.size();
        int ret = nums[0];
        int max_nums, min_nums;
        max_nums = min_nums = nums[0];
        for (int i = 1; i < n; i++) {
            int t_min = min_nums, t_max = max_nums;
            max_nums = max(max(t_max * nums[i], t_min * nums[i]), nums[i]);
            min_nums = min(min(t_min * nums[i], t_max * nums[i]), nums[i]);
            ret = max(max_nums, ret);
        }
        return ret;
    }
};

//